﻿<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage/Site.Master" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="BugSysSolution.TestPage.test2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div id="_div" style='position:absolute;width:700px;height:500px;border:1px solid red;'>
    
</div>

<script type="text/javascript">
    var a = function (b) {
        this.el = $("<div style='position:relative;width:100px;height:100px;border:1px solid red;'></div>");
        this.setId = function (id) {
            this.el.attr("id", id);
        }
        this.setPosition = function (top, left) {
            this.el.css("top", top).css("left", left);
        }
        this.setValue = function (val) {
            this.el.html(val);
        }
        this.move = function () {
            this.el.mousemove(function (e) {
                b.emove(e);
            })
        }
        this.show = function () {
            $("#_div").append(this.el);
        }

        this.Init = function () {
            this.move();
            this.show();
        }
    }

    var b = function () {
        this.emove = function (e) {
            alert(e.target.id);
        }
        return this;
    }

    var a1 = new a(b());
    a1.setId("div1");
    a1.setPosition(100, 100);
    a1.setValue("a1");
    a1.Init();

    var a2 = new a(b());
    a2.setId("div2");
    a2.setPosition(200, 200);
    a2.setValue("a2");
    a2.Init();
    

//    var cvs = document.getElementById('cnv').getContext('2d');
//    //创建canvas画布元素的设计器
//    var HTML5Engine = function (can, es) {
//        this.createLine = function (html) {
//            //创建jq line对象 就是画出来
//            this.elline = $(html);
//            //初始化--主要是声名JQDOM的事件
//            this.InitLine = function () {
//                this.elline.mousemove(function (e) {
//                    es._moveline(e);
//                })
//                //....需要用到的方法
//            }
//            this.show = function (obj) {
//                $(obj).append(this.elline);
//            }
//        }
//    }

//    //所有的事件全部放在这个类里
//    var Events = function () {
//        this._moveline = function (e) {
//            
//        }
//        return this;
//    }

//    var h5 = new HTML5Engine(cvs, Events());
//    h5.createLine("<htmltag></htmltag>");
//    h5.InitLine();
</script>
</asp:Content>
